<?php
/**
 * Introduction: 活动表  activity
 */

namespace Common\Model;


use Think\Model;

class ActivityModel extends Model
{
    //定义数据库连接信息
    protected $connection;

    //定义表名
    protected $tableName = 'activity';

    /**
     * 初始化
     */
    public function _initialize()
    {

        $this->connection = C('Databaese');

    }

    /**
     * 获取活动列表
     */
    public function getlist($type,$num,$limit){
        $list = $this->where("is_show_app=1 and status=1 and type1=$type")->order("displayorder desc")->limit("$num,$limit")->select();
        $res = [];
        if($type==1){
            $count = $this->where("is_show_app=1 and status=1 and type1=$type")->count();
            $res['total_count'] = $count;
        }
        $res['list'] = $list;
        return $res;
    }


}